# Maintainer: Thiago Perrotta <tbperrotta@gmail.com>
pkgname=argocd
pkgver=2.12.4
pkgrel=0
pkgdesc="Declarative continuous deployment for Kubernetes"
url="https://argo-cd.readthedocs.io/"
arch="all !armhf !armv7 !x86"
license="Apache-2.0"
makedepends="go make"
options="net"
subpackages="$pkgname-doc $pkgname-bash-completion $pkgname-zsh-completion"
source="argo-cd-$pkgver.tar.gz::https://github.com/argoproj/argo-cd/archive/v$pkgver.tar.gz"
builddir="$srcdir/argo-cd-$pkgver"

build() {
	make CGO_FLAG=1 LDFLAGS="" cli-local

	dist/argocd completion bash > argocd.bash
	dist/argocd completion zsh > argocd.zsh
}

check() {
	dist/argocd version | grep -q "argocd: v${pkgver}"
}

package() {
	install -Dm755 "dist/argocd" "$pkgdir/usr/bin/argocd"

	install -Dm644 argocd.bash "$pkgdir/usr/share/bash-completion/completions/argocd"
	install -Dm644 argocd.zsh "$pkgdir/usr/share/zsh/site-functions/_argocd"

	install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}

sha512sums="
ad5ef5bf9bcdd0d75921095e2d0caa7741ec4990ded54ab2f4c8099a32e6dcd594088b1743333b14e972a09312e838708fe41876206e3d4090c8d5b6550c0725  argo-cd-2.12.4.tar.gz
"
